<template>
    <div>
        <el-form :inline="true">
            <el-form-item label="单位编码">
                <el-input v-model="orderNo" placeholder="请输入编码"></el-input>
            </el-form-item>
            <el-form-item label="单位名称">
                <el-input v-model="orderNo" placeholder="请输入名称"></el-input>
            </el-form-item>
            <el-button type="primary" icon="el-icon-search">搜索</el-button>
        </el-form>

        <el-button size="mini" style="background-color:#ADD8E6 "
            v-perm:productionsystem:masterdata:unit:insert="Insert">新增</el-button>
        <el-button size="mini " style=" background-color: #90EE90"
            v-perm:productionsystem:masterdata:unit:update="Update">修改</el-button>
        <el-button size="mini" style="background-color: #FFCCCB">删除</el-button>

        <div style="display: flex; flex-direction: column; gap: 10px;">
            <el-table style="width: 100%" :data="salesorder" @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column prop="unitCode" label="单位编码" width="180"></el-table-column>
                <el-table-column prop="unitName" label="单位名称" width="180"></el-table-column>
                <el-table-column prop="isprimaryUnit" label="是否为主单位" width="180"></el-table-column>
                <el-table-column prop="unit" label="与主单位换算比例" width="180"></el-table-column>
                <el-table-column prop="status" label="是否启用" width="180"></el-table-column>
                <el-table-column prop="remark" label="备注" width="180"></el-table-column>
                <el-table-column label="操作" width="300px">
                    <template #default="scope">
                        <el-button :row="scope.row" type="text">修改</el-button>
                        <el-button type="text" size="mini">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <el-dialog :destroy-on-close="true" :title="title" v-model="visible">
            <router-view :data="data" @close="close"></router-view>
        </el-dialog>
    </div>
</template>

<script setup>

import { ref } from 'vue';
import router from '@/router';
let visible = ref(false)
let title = ref("");
let data = ref({});

const salesorder = ref([
    {
        unitCode: '1001',
        unitName: '单位1',
        isprimaryUnit: '是',
        unit: '1',
        status: '启用',
        remark: '备注1'

    }]);


let Insert = (salesorder) => {
    console.log(salesorder)
    visible.value = true;
    router.push(salesorder.path)
}

let Update = (salesorder) => {
    console.log(salesorder)
    visible.value = true;
    router.push(salesorder.path)
}
let close = () => {
    visible.value = false;
    loadData();
}


</script>

<style lang='scss' scoped></style>
